Xbasic

Date and Time Functions

Description

Methods to support date and time data types.

Name
Description
*add_days Function

Add days to date or time.

*add_hours Function

Add hours to date or time.

*add_minutes Function

Add minutes to date or time.

*add_months Function

Add months to date or time.

*add_seconds Function

Add seconds to date or time.

*add_years Function

Add years to date or time.

*days_between Function

Return difference of days between two dates or times.

*hours_between Function

Return difference of hours between two dates or times.

*minutes_between Function

Return difference of minutes between two dates or times.

*months_between Function

Return difference of months between two dates or times.

*seconds_between Function

Return difference of seconds between two dates or times.

*years_between Function

Return difference of years between two dates or times.

a5_add_timestamp Function

Adds a date and time stamp to a script or function when it is saved

A5_CONVERT_DATE_STRING Function

The A5_CONVERT_DATE_STRING() function reformats a date string, by converting a date string from one format to another. E.g. from DMY format to YMD format.

A5_CONVERT_DATETIME_STRING Function

The A5_CONVERT_DATETIME_STRING() function reformats a date portion of a date time string, by converting a datetime string from one format to another. E.g. from DMY format to YMD format.

a5_embeddedcalendargenie Function

Display the datePicker genie

a5_get_date_format Function

Determines if the default date format is 'm/d' - USA format, or 'd/m' - non USA format.

A5_GETDATEHTML Function

Displays a dialog with a popup calendar rendered using HTML.

a5_gettimeformats Function

Get the time format strings

a5_gettimevalue Function

Prompt for a time value

a5_normalizedate Function

Used to normalize a character date or date/time value so that it conforms to local regional settings. You can specify an optional 'switch year' in the format: e.g. mm/dd/yy::30.

A5_RFC1123DATE Function

Converts a date string to an RFC 1123 formatted date (Day, dd Month yyyy hh:mm:ss TIMEZONE)

A5_RFC822DATE Function

Converts a date string to an RFC 822 formatted date (Day, dd Month yy hh:mm:ss TIMEZONE)

A5_RFC850DATE Function

Converts a date string to an RFC 850 formatted date (Weekday, dd-Mon-yy hh:mm:ss TIMEZONE)

A5_T_FROM_RFCDATE Function

Converts a time in RFC 822, RFC 850, RFC 1123 or ANSI C format to a time variable

a5_time_format_help Function

Builder for time/date format string.

A5_TIMESTAMP Function

Generates a timestamp as a character string for the current time.

ADD_BUS_DAYS Function

ADD_BUS_DAYS() returns an Ending_Date equal to Starting_Date plus Add_Days number of business days.

ADDMONTHS Function

Adds a number of months to a date.

ADDYEARS Function

Adds a number of years to a date.

AGE Function

Computes a person's age. If AsOfDate is not supplied, then age as of today is computed. If AsOfDate is supplied, then age on the AsOfDate is computed.

BUS_DAYS_BETWEEN Function

BUS_DAYS_BETWEEN() returns the number of business days between two dates, ignoring weekends and holidays. To use a SQL datasource, 'holidayTable' can be a JSON string with these properties: connectionString, table, column. e.g. {connectionString: 'northwind', table: 'holidays', column: 'dates'}

CDATE Function

Converts a date to a character value in the form 'YYYYMMDD'.

CDOW Function

CDOW() returns a character string containing the name of the day of the week for the specified Date. If the optional localized flag is true, report the localized day name. (Localized flag requires Version 10.5 or later)

CMONTH Function

CMONTH() returns the Month_Name in the specified Date or Date_Time. If the optional localized flag is true, report the localized day name. (Localized flag requires Version 10.5 or later).

CONVERT_TYPE Function

Converts a value from one data type to another.

CShortTime Function

The CShortTime() function converts a short time value into a character value (string) that can be used in a sort expression. Format is 0h0m0s3.

CTIME Function

The CTIME() function converts a time value into a character value (string) that can be used in a sort expression. Format is YYYYMMDD0h0m0s3.

CTOD Function

Converts a character string to a date value.

CTODT Function

The CTODT() function converts a date and time string to a Date Time value (date + time).

CTOT Function

The CTOT() function converts a time string to a Short Time value.

CYEAR Function

Converts a date to a character value of the form 'YYYY'.

Date and Time Conversion Matrix

A list of Inputs and Outputs relating to date time functions.

Date and Time Format Elements

A date format is created from the following date format elements.

Date and Time Functions

Alpha Anywhere provides the following Date and Time functions.

DATE Function

Returns the current system date.

Date_FirstDayOfMonth Function

Returns the first day of the month for a given date. If no argument is supplied, first day of current month.

Date_FirstDayOfPreviousMonth Function

Returns the first day of the previous month for a given date. If no argument is supplied, returns last day of the previous month for the current date.

DATE_FORMAT Function

Formats a date value using a user defined format string

DATE_FORMATS_BUILT_IN Function

Date formats for the dtoc() function

date_from_utc_date Function

Convert a UTC date-time to a date or time

date_is_anniversary Function

Returns .t. if a date or time value has the same month and day as a ReferenceDate. If ReferenceDate is blank, then today's date is used as the ReferenceDate.

date_is_in_last_month Function

Takes a date or time value and returns .t. if the date is in the previous Month

DATE_IS_IN_MONTH Function

True if date is in specified month. Month can be a Character or Numeric value

date_is_in_previous_quarter Function

Takes a date or time value and returns .t. if the date is in the previous Quarter

date_is_in_previous_week Function

Takes a date or time value and returns .t. if the date is in the week

date_is_in_previous_year Function

Takes a date or time value and returns .t. if the date is in the previous year

date_is_in_same_week Function

Takes a date or time value and returns .t. if the date is in the same week as the week of the reference date

date_is_in_this_month Function

Takes a date or time value and returns .t. if the date is in this Month

date_is_in_this_month_todate Function

Takes a date or time value and returns .t. if the date is in this Month-to-date

date_is_in_this_quarter Function

Takes a date or time value and returns .t. if the date is in this Quarter

date_is_in_this_quarter_todate Function

Takes a date or time value and returns .t. if the date is in this Quarter

date_is_in_this_week Function

Returns .t. if the date is in the current week.

date_is_in_this_week_todate Function

Takes a date or time value and returns .t. if the date is in this week-to-date

date_is_in_this_year Function

Takes a date or time value and returns .t. if the date is in this year

date_is_in_this_year_todate Function

Takes a date or time value and returns .t. if the date is in this year-to-date

date_is_today Function

Takes a date or time value and returns .t. if the date is today

date_is_yesterday Function

Takes a date or time value and returns .t. if the date is yesterday

Date_LastDayOfMonth Function

Returns the last day of the month for a given date. If no argument is supplied, last day of current month.

Date_LastDayOfPreviousMonth Function

The Date_LastDayOfPreviousMonth() function returns the last day of the previous month for a given date. If no argument is supplied, returns last day of the previous month for the current date.

date_quarternumber Function

Takes as date or time value and returns the Quarter in which the date falls

date_quarterstartend Function

Returns two properties - .StartDate and .EndDate with the start and end date for the specified quarter.

date_to_utc_date Function

Convert a date or time to a UTC date-time

DATE_VALUE Function

Returns a date value. Errors if date is out of range

DAY Function

DAY() returns an integer corresponding to the day of the month for the Date or Date_Time value.

DAY_NUMBER Function

DAY_NUMBER() returns the number of a given day. You only need to specify the first three characters of the Day_Name. Sunday is 1.

DMY Function

Converts a date to a character string in the 'DD Month YYYY' format.

DOW Function

DOW() returns an integer indicating the day of the week for the Date or Date_Time value.

DOW_ISO Function

Returns the ISO 8601 Day of Week # where Monday is day 1 and Sunday is day 7

DTOC Function

Converts a date into a character value in the form 'MM/DD/YYYY'.

DTOS Function

Converts a date into a character value in the form 'YYYYMMDD'.

FixDateString Function

Takes a date string and a date format and transforms the date string so that it matches the format that Alpha Anywhere expects (based on the current Regional Settings configuration). The year portion MUST be the last part of the date format. I.e. Does not support formats like YYYY/mm/dd

FORMAT_DATA Function

Formats an input string using a format_code. Returns a character string.

GetTimeZoneOffset Function

The GetTimeZoneOffset() function returns difference between the time zone of the computer and Greenwich Mean Time in hours.

GMT Function

GMT() returns Greenwich Mean Time on the system clock as a Formatted_Short_Time ('HH:MM:SS'). For information on the optional Format_String parameter.

Holidays

This panel lets you enter holidays to be used in your Alpha Anywhere databases.

httpdate Function

Creates an HTTP compliant date/time string

international_days_of_week Function

Returns day of week, using current culture settings

international_months Function

Returns name for all months, using current culture settings

JDATE Function

Returns a number which is the Julian equivalent to a specified date.

JTODATE Function

Returns a date value which is the equivelant to the supplied Julian number.

MDY Function

Returns a formatted character string in the 'Month DD, YYYY' format.

MONTH Function

Returns the number of the month in a date.

MONTH_END Function

Computes the date on which a month ends for any given date.

MONTH_NUMBER Function

Returns the month number for a given month name

MONTH_START Function

Computes the date on which a month starts for any given date.

NOW Function

Returns the current time. The time can be returned as either local time (default) or GMT.

NTH_DOW Function

Finds the date for the 'n'th day in a month. e.g. the 4th Thursday for November in 2005

ODBC_DT_TO_D Function

Converts a character field containing a Date-Time value in format "YYYY-MM-DD HH:MM:SS.SSS" to a date field.

Predefined Date Formats

The following formats can be used with the DTOC() function.

ProgressTimed Function

Displays a progress bar for the specified number of seconds.

SCANTIME Function

Converts time string to time - uses format to parse the time - optional third parameter is old time to get non-specified values from.

ShortTime_Extract Function

Extracts hours, minutes, or seconds from a Short time value. TimePart is 'h', 'm', or 's'

STOD Function

Convert a date in YYYYMMDD format to {MM/DD/YYYY}

Time and Date Functions

Descriptions and examples of time and date functions.

TIME Function

Returns the current time on the system clock as a string value using the format 'HH:MM:SS', optional format controls other times, passed in time type can be used in place of the current time.

time_gmt_to_local Function

Converts GMT time to local time.

time_to_unixtimestamp Function

Converts a time value to a Unix timestamp value.

TIME_VAR Function

Returns a time variable

timez Function

Same as time(), but returns a null string if time is a null value.

TOSECONDS Function

Converts a time value to seconds.

TOTIME Function

Converts a time value to a formatted time character string.

TZ_OFFSET_TO_C Function

The TZ_OFFSET_TO_C() function calls the GetTimeZoneOffset()function and formats the result as a character string.

unixtimestamp_to_time Function

Converts a Unix timestamp number (seconds since 1970-1-1) to a time value

WEEK Function

Get the calendar week number of a date where Sunday is the first day of the week.

WEEK_ISO Function

Get the ISO calendar week number for a date where Monday is the first day of the week.

WEEK_ISO_FULL Function

Get the full ISO week in the format "YYYY-W##-d" where YYYY is the year, W## is the week number, and d is the day of the week.

WIN_TIME Function

The WIN_TIME() function returns information about the Windows time settings of a computer.

WMI_DATE_TO_TIME Function

Legacy. Converts a CIM Date Time string

wmi_datetime_to_time Function

Converts a CIM Datetime string as used by WMI to an Alpha Anywhere time value in the local timezone

YEAR Function

Returns a four digit integer equal to the year portion of the specified Date or Date_Time value.

YearStart_ISO Function

The YearStart_ISO() function returns the first day of the ISO year.